]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
userWidget: Fix avatar size
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 7 Mar 2019 12:39:17 +0000 (13:39 +0100)
committerMarco Trevisan <mail@3v1n0.net>
Tue, 12 Mar 2019 00:34:04 +0000 (00:34 +0000)
The texture cache now returns an actor with an appropriate ClutterContent
rather than a ClutterTexture. That actor uses the CONTENT_SIZE request
mode, which means that it will unconditionally request the preferred size
of the content. That is, setting an explicit size no longer has an effect.

Fix this by making sure the image is already loaded with the desired
dimensions.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1024

js/ui/userWidget.js

index a3bf4cba18fd7cb79f434d83c93642e0f991f166..a11b34b02e89d804585bcbd2a69f15ec5167f564 100644 (file)
@@ -46,15 +46,14 @@ var Avatar = class {
         if (iconFile) {
             let file = Gio.File.new_for_path(iconFile);
             this.actor.child = null;
-            this.actor.style = 'background-image: url("%s");'.format(iconFile);
+            this.actor.style = `
+                background-image: url("${iconFile}");
+                background-size: ${this._iconSize}px`;
         } else {
             this.actor.style = null;
             this.actor.child = new St.Icon({ icon_name: 'avatar-default-symbolic',
                                              icon_size: this._iconSize });
         }
-
-        let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor;
-        this.actor.set_size(this._iconSize * scaleFactor, this._iconSize * scaleFactor);
     }
 };